image=imread("fig6.tif");
subplot(3,2,1),imshow(image);
subplot(3,2,2),imhist(uint8(image));
testImage=imadjust(image,[0.2,0.9],[]);
subplot(3,2,3),imshow(testImage);
subplot(3,2,4),imhist(testImage);
[m,n]=size(testImage);
p=zeros(1,256);
for i=1:m
    for j=1:n
        value=testImage(i,j);
        p(value+1)=p(value+1)+1;
    end
end
p=p/(m*n);
s=zeros(1,256);  
for i=1:256  
     for j=1:i  
         s(i)=p(j)+s(i);                  
     end  
end 
a=round(s*255); 
b=testImage;
for i=1:m
    for j=1:n
        b(i,j)=a(testImage(i,j)+1);
    end
end
subplot(3,2,5),imshow(b);
subplot(3,2,6),imhist(b);
